import request from '@/utils/request'

// 获取已激活的优惠券列表
export function getActiveCoupons() {
  return request({
    url: '/admin/coupon-distribution/active-coupons',
    method: 'get'
  })
}

// 分页查询用户列表
export function getUserList(data) {
  return request({
    url: '/admin/coupon-distribution/users',
    method: 'post',
    data
  })
}

// 发放优惠券
export function distributeCoupons(data) {
  return request({
    url: '/admin/coupon-distribution/distribute',
    method: 'post',
    data
  })
}

// 检查用户是否已拥有优惠券
export function checkUserCoupon(userId, couponId) {
  return request({
    url: '/admin/coupon-distribution/check-user-coupon',
    method: 'get',
    params: {
      userId,
      couponId
    }
  })
}

// 获取优惠券发放统计
export function getCouponStats(couponId) {
  return request({
    url: `/admin/coupon-distribution/coupon-stats/${couponId}`,
    method: 'get'
  })
}
